webpackJsonp([50],{

/***/ "ebOn":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/plugin/index.js + 207 modules
var common_plugin = __webpack_require__("Tvds");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/law/record.vue



//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//





/* harmony default export */ var law_record = ({
  data: function data() {
    return {
      form: {},
      records: [],
      userList: []
    };
  },
  activated: function activated() {
    if (!this.$router.$isBack) {
      this.init();
      this.fetchData();
    }
    this.fetchRecord();
  },

  methods: {
    goRecord: function goRecord() {
      this.$router.$push({
        path: '/law/record/content',
        query: this.$route.query
      });
    },
    init: function init() {
      var _this = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var form, _ref, D0002;

        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _this.record = _this.$route.query.record;
                _context.next = 3;
                return commonApi["a" /* commonApi */].searchById('law_record', _this.record, {
                  include: ['enterprise_id']
                });

              case 3:
                form = _context.sent;

                _this.form = Object(utils["c" /* PointerToString */])(form, ['check_person:array']);

                if (!_this.form.document_num) {
                  _context.next = 7;
                  break;
                }

                return _context.abrupt('return');

              case 7:
                _context.next = 9;
                return commonApi["a" /* commonApi */].runCloud('lawGetDocumentNum', {
                  year: new Date().getFullYear()
                });

              case 9:
                _ref = _context.sent;
                D0002 = _ref.D0002;

                _this.form = extends_default()({}, _this.form, { document_num: D0002 });

              case 12:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this);
      }))();
    },
    fetchData: function fetchData() {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.next = 2;
                return commonApi["a" /* commonApi */].search('aj_organization_personnel', {
                  include: ['OrganizationIds'],
                  matchesQuery: {
                    OrganizationIds: commonApi["a" /* commonApi */].createQueryIncludeOptions('sys_organizations', {
                      equalTo: {
                        Name: '安监局执法'
                      }
                    })
                  }
                });

              case 2:
                _this2.userList = _context2.sent;

              case 3:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2);
      }))();
    },
    fetchRecord: function fetchRecord() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        var record;
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                record = _this3.$route.query.record;
                _context3.next = 3;
                return commonApi["a" /* commonApi */].search('law_record_danger', {
                  equalTo: { record_id: record }
                });

              case 3:
                _this3.records = _context3.sent;

              case 4:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this3);
      }))();
    },
    onSubmit: function onSubmit(loaded) {
      var _this4 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee4() {
        var form;
        return regenerator_default.a.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                _context4.prev = 0;
                form = Object(utils["a" /* BuildPointer */])(_this4.form, {
                  check_person: 'aj_organization_personnel'
                });

                if (!(form.state !== 1)) {
                  _context4.next = 6;
                  break;
                }

                form.state = 1;
                _context4.next = 6;
                return commonApi["a" /* commonApi */].save('law_plan', {
                  id: _this4.$route.query.id,
                  state: 2
                });

              case 6:
                _context4.next = 8;
                return commonApi["a" /* commonApi */].save('law_record', form);

              case 8:
                _this4.$router.$back();
                _this4.$Toast('保存成功!', 'success');
                _context4.next = 15;
                break;

              case 12:
                _context4.prev = 12;
                _context4.t0 = _context4['catch'](0);

                _this4.$Toast('保存失败!', 'error');

              case 15:
                loaded();

              case 16:
              case 'end':
                return _context4.stop();
            }
          }
        }, _callee4, _this4, [[0, 12]]);
      }))();
    },
    onPreview: function onPreview(loaded) {
      var _this5 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee5() {
        var word, _ref2, url;

        return regenerator_default.a.wrap(function _callee5$(_context5) {
          while (1) {
            switch (_context5.prev = _context5.next) {
              case 0:
                _context5.prev = 0;
                _context5.next = 3;
                return commonApi["a" /* commonApi */].runCloud('officeCopy', {
                  code: 'D0002',
                  data: _this5.$route.query.id
                });

              case 3:
                word = _context5.sent;
                _context5.next = 6;
                return commonApi["a" /* commonApi */].runCloud('WordToPdf', { word: word });

              case 6:
                _ref2 = _context5.sent;
                url = _ref2.url;

                if (url) {
                  _context5.next = 12;
                  break;
                }

                _this5.$Toast('文件转换失败，请尝试重新预览！', 'error');
                loaded();
                return _context5.abrupt('return');

              case 12:
                common_plugin["b" /* bridge */].PreviewPdf({ title: '文件标题', url: url });
                _context5.next = 17;
                break;

              case 15:
                _context5.prev = 15;
                _context5.t0 = _context5['catch'](0);

              case 17:
                loaded();

              case 18:
              case 'end':
                return _context5.stop();
            }
          }
        }, _callee5, _this5, [[0, 15]]);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-42ecb27f","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/law/record.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"现场检查记录"}},[_c('yt-form',[_c('yt-card',{attrs:{"title":"基本信息"}},[_c('yt-cell',{attrs:{"label":"文书编号","value":_vm.form.document_num}},[_c('yt-input',{attrs:{"clearable":false,"placeholder":"请输入文书编号..."},model:{value:(_vm.form.document_num),callback:function ($$v) {_vm.$set(_vm.form, "document_num", $$v)},expression:"form.document_num"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查场所"}},[_c('yt-input',{attrs:{"clearable":false,"placeholder":"请输入检查场所..."},model:{value:(_vm.form.check_pos),callback:function ($$v) {_vm.$set(_vm.form, "check_pos", $$v)},expression:"form.check_pos"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查人员"}},[_c('yt-cell-select',{attrs:{"max":2,"list":_vm.userList,"label":"DisplayName","val":"id"},model:{value:(_vm.form.check_person),callback:function ($$v) {_vm.$set(_vm.form, "check_person", $$v)},expression:"form.check_person"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"开始时间"}},[_c('yt-cell-time',{attrs:{"format":"YYYY-MM-DD hh:mm"},model:{value:(_vm.form.check_start),callback:function ($$v) {_vm.$set(_vm.form, "check_start", $$v)},expression:"form.check_start"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"结束时间","border":"none"}},[_c('yt-cell-time',{attrs:{"format":"YYYY-MM-DD hh:mm"},model:{value:(_vm.form.check_end),callback:function ($$v) {_vm.$set(_vm.form, "check_end", $$v)},expression:"form.check_end"}})],1)],1),_vm._v(" "),_c('yt-card',{attrs:{"title":"隐患记录","btn":"添加执法记录"},on:{"btn-click":_vm.goRecord}},_vm._l((_vm.records),function(item,index){return _c('p',{key:index,staticClass:"row"},[_vm._v(_vm._s(index + 1)+" : "+_vm._s(item.danger_desc))])}),0),_vm._v(" "),(_vm.form.state === 0)?_c('yt-btn',{attrs:{"slot":"btn","loading":_vm.onSubmit,"theme":"blue","edge":""},slot:"btn"},[_vm._v("保存")]):_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false,"edge":""},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onSubmit,"loadingOption":{color: '#46baff'}}},[_vm._v("保存")]),_vm._v(" "),_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onPreview,"loadingOption":{color: '#46baff'}}},[_vm._v("预览文书")])],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var anjian_law_record = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/law/record.vue
function injectStyle (ssrContext) {
  __webpack_require__("kvIK")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-42ecb27f"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  law_record,
  anjian_law_record,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var common_anjian_law_record = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "kvIK":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});